
import os
import shutil

look_folder = 'D:/PythonProjects/revised_hot_work_classes6_task2/labels/train'
is_folder = 'C:/Users/22191/Desktop/is'
target_folder = 'D:/PythonProjects/revised_hot_work_classes6_task2/images/train'

look_files = os.listdir(look_folder)
look_files = [f for f in look_files if f.endswith('.txt')]

for look_file in look_files:
    i_file = look_file.replace('.txt', '.jpeg')
    i_path = os.path.join(is_folder, i_file)
    
    if os.path.exists(i_path):
        target_path = os.path.join(target_folder, i_file)
        shutil.copy(i_path, target_path)